package cn.jbit.dao.impl;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import cn.jbit.dao.UserDao;
import cn.jbit.houserent.bean.User;

public class UserDaoImpl extends HibernateDaoSupport implements UserDao {

	@Override
	public User findUser(String name, String pwd) {
		List<User> list=this.getHibernateTemplate().find("from User where name=? and password=?",name,pwd);
		if(list.size()>0){
			return list.get(0);
		}
		return null;
	}

	@Override
	public void addUser(User user) {
		this.getHibernateTemplate().save(user);
	}
}
